<template>
  <div class="app-container">
    <el-card class="box-card">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" >
      <!--   <el-form-item label="学习开始时间" prop="startingTime">
           <el-date-picker clearable
                           v-model="queryParams.startingTime"
                           type="date"
                           value-format="yyyy-MM-dd"
                           placeholder="请选择学习开始时间">
           </el-date-picker>
         </el-form-item>
         <el-form-item label="学习结束时间" prop="endingTime">
           <el-date-picker clearable
                           v-model="queryParams.endingTime"
                           type="date"
                           value-format="yyyy-MM-dd"
                           placeholder="请选择学习结束时间">
           </el-date-picker>
         </el-form-item>-->
      <el-form-item label="授课人" prop="lecturer">
        <el-input
          v-model="queryParams.lecturer"
          placeholder="请输入授课人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="学习内容" prop="learningContent">
        <el-input
          v-model="queryParams.learningContent"
          placeholder="请输入学习内容"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
      <el-form-item label="课时" prop="lesson">
        <el-input
          v-model="queryParams.lesson"
          placeholder="请输入课时"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="授课地点" prop="location">
        <el-input
          v-model="queryParams.location"
          placeholder="请输入授课地点"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="ID" prop="id">
        <el-input
          v-model="queryParams.id"
          placeholder="请输入ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="姓名" prop="username">
        <el-input
          v-model="queryParams.username"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部职别" prop="departmentTitle">
        <el-input
          v-model="queryParams.departmentTitle"
          placeholder="请输入部职别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出生日期" prop="birth">
        <el-input
          v-model="queryParams.birth"
          placeholder="请输入出生日期"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="性别" prop="gender">
        <el-input
          v-model="queryParams.gender"
          placeholder="请输入性别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="证件编号" prop="certificateId">
        <el-input
          v-model="queryParams.certificateId"
          placeholder="请输入证件编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="年龄" prop="age">
        <el-input
          v-model="queryParams.age"
          placeholder="请输入年龄"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门" prop="deptid">
        <el-input
          v-model="queryParams.deptid"
          placeholder="请输入部门"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证号" prop="idNumber">
        <el-input
          v-model="queryParams.idNumber"
          placeholder="请输入身份证号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="手机号1" prop="phoneOne">
        <el-input
          v-model="queryParams.phoneOne"
          placeholder="请输入手机号1"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="手机号2" prop="phoneSecond">
        <el-input
          v-model="queryParams.phoneSecond"
          placeholder="请输入手机号2"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="籍贯" prop="nativePlace">
        <el-input
          v-model="queryParams.nativePlace"
          placeholder="请输入籍贯"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出生地" prop="birthplace">
        <el-input
          v-model="queryParams.birthplace"
          placeholder="请输入出生地"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="民族" prop="nation">
        <el-input
          v-model="queryParams.nation"
          placeholder="请输入民族"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最高学历" prop="highestEducation">
        <el-input
          v-model="queryParams.highestEducation"
          placeholder="请输入最高学历"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最高学位" prop="highestDegree">
        <el-input
          v-model="queryParams.highestDegree"
          placeholder="请输入最高学位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="毕业学校" prop="graduationSchool">
        <el-input
          v-model="queryParams.graduationSchool"
          placeholder="请输入毕业学校"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业" prop="major">
        <el-input
          v-model="queryParams.major"
          placeholder="请输入专业"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="人员类别" prop="personnelCategory">
        <el-input
          v-model="queryParams.personnelCategory"
          placeholder="请输入人员类别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="政治面貌" prop="politics">
        <el-input
          v-model="queryParams.politics"
          placeholder="请输入政治面貌"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="入党" prop="partyTime">
        <el-date-picker clearable
                        v-model="queryParams.partyTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择入党">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="参加工作时间" prop="workingTime">
        <el-date-picker clearable
                        v-model="queryParams.workingTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择参加工作时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="入伍时间" prop="militaryTime">
        <el-date-picker clearable
                        v-model="queryParams.militaryTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择入伍时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="JX" prop="baseRank">
        <el-input
          v-model="queryParams.baseRank"
          placeholder="请输入JX"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="用户ID" prop="userId">
        <el-input
          v-model="queryParams.userId"
          placeholder="请输入用户ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门ID" prop="deptId">
        <el-input
          v-model="queryParams.deptId"
          placeholder="请输入部门ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建者" prop="createBy">
        <el-input
          v-model="queryParams.createBy"
          placeholder="请输入创建者"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker clearable
                        v-model="queryParams.createTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="更新者" prop="updateBy">
        <el-input
          v-model="queryParams.updateBy"
          placeholder="请输入更新者"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="更新时间" prop="updateTime">
        <el-date-picker clearable
                        v-model="queryParams.updateTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择更新时间">
        </el-date-picker>
      </el-form-item>-->
      <br/>
      <div style="text-align:right;">

        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>

      </div>
      <br/>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['yzx:education:education:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['yzx:education:education:remove']"
        >删除</el-button>
      </el-col>
<!--      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
    </el-row>
    <el-table v-loading="loading" :data="educationList" border @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column type="index" label="序号"  width="55" :index="indexMethod" align="center"/>
<!--      <el-table-column label="学习记录序号" align="center" prop="studyRecordId" />-->
<!--      <el-table-column label="学习内容" align="center" prop="learningContent" />-->
<!--      <el-table-column label="学习开始时间" align="center" prop="startingTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.startingTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="学习结束时间" align="center" prop="endingTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.endingTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>-->
      <el-table-column label="授课人" align="center" prop="lecturer" />
      <el-table-column label="课时" align="center" prop="lesson" />
      <el-table-column label="授课地点" align="center" prop="location" />
<!--      <el-table-column label="个人笔记" align="center" prop="personalNotes" />
      <el-table-column label="学习心得" align="center" prop="learningExperience" />-->
<!--      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="姓名" align="center" prop="username" />
      <el-table-column label="部职别" align="center" prop="departmentTitle" />
      <el-table-column label="出生日期" align="center" prop="birth" />
      <el-table-column label="性别" align="center" prop="gender" />
      <el-table-column label="证件编号" align="center" prop="certificateId" />
      <el-table-column label="年龄" align="center" prop="age" />
      <el-table-column label="部门" align="center" prop="deptid" />
      <el-table-column label="身份证号" align="center" prop="idNumber" />
      <el-table-column label="手机号1" align="center" prop="phoneOne" />
      <el-table-column label="手机号2" align="center" prop="phoneSecond" />
      <el-table-column label="籍贯" align="center" prop="nativePlace" />
      <el-table-column label="出生地" align="center" prop="birthplace" />
      <el-table-column label="民族" align="center" prop="nation" />
      <el-table-column label="最高学历" align="center" prop="highestEducation" />
      <el-table-column label="最高学位" align="center" prop="highestDegree" />
      <el-table-column label="毕业学校" align="center" prop="graduationSchool" />
      <el-table-column label="专业" align="center" prop="major" />
      <el-table-column label="人员类别" align="center" prop="personnelCategory" />
      <el-table-column label="政治面貌" align="center" prop="politics" />
      <el-table-column label="入党" align="center" prop="partyTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.partyTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="参加工作时间" align="center" prop="workingTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.workingTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="入伍时间" align="center" prop="militaryTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.militaryTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="教育培训经历" align="center" prop="educationTraining" />
      <el-table-column label="参加ZZ情况" align="center" prop="combatParticipation" />
      <el-table-column label="参加重大JS行动情况" align="center" prop="majorOperations" />
      <el-table-column label="奖惩情况" align="center" prop="reward" />
      <el-table-column label="简历" align="center" prop="resume" />
      <el-table-column label="JX" align="center" prop="baseRank" />
      <el-table-column label="用户ID" align="center" prop="userId" />
      <el-table-column label="部门ID" align="center" prop="deptId" />
      <el-table-column label="创建者" align="center" prop="createBy" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新者" align="center" prop="updateBy" />
      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      -->
      <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"

            @click="handleUpdate(scope.row)"
            v-hasPermi="['yzx:education:education:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"

            @click="handleDelete(scope.row)"
            v-hasPermi="['yzx:education:education:remove']"
          >删除</el-button>
          <el-button
            size="mini"
            type="text"
            @click="handlelook(scope.row)"
          >详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    </el-card>
    <!-- 添加或修改职业教育学习档案对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-container>
          <el-main>
            <el-row>
              <el-col span="8" >
                <el-form-item label="授课地点" prop="location">
                  <el-input v-model="form.location" placeholder="请输入授课地点" />
                </el-form-item>

              </el-col>
              <el-col span="8" >
<!--        <el-form-item label="学习开始时间" prop="startingTime">
          <el-date-picker clearable
                          v-model="form.startingTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择学习开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="学习结束时间" prop="endingTime">
          <el-date-picker clearable
                          v-model="form.endingTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择学习结束时间">
          </el-date-picker>
        </el-form-item>-->
        <el-form-item label="授课人" prop="lecturer">
          <el-input v-model="form.lecturer" placeholder="请输入授课人" />
        </el-form-item>
              </el-col>
                <el-col span="8" >
        <el-form-item label="课时" prop="lesson">
          <el-input v-model="form.lesson" placeholder="请输入课时" />
        </el-form-item>
                </el-col>
            </el-row>

            <el-form-item label="学习内容">
              <editor v-model="form.learningContent" :min-height="100"/>
            </el-form-item>
        <el-form-item label="个人笔记" prop="personalNotes">
          <el-input v-model="form.personalNotes"  type="textarea" :rows="6" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="学习心得" prop="learningExperience">
          <el-input v-model="form.learningExperience"  type="textarea" :rows="6" placeholder="请输入内容" />
        </el-form-item>
        <!-- <el-form-item label="ID" prop="id">
           <el-input v-model="form.id" placeholder="请输入ID" />
         </el-form-item>
         <el-form-item label="姓名" prop="username">
           <el-input v-model="form.username" placeholder="请输入姓名" />
         </el-form-item>
         <el-form-item label="部职别" prop="departmentTitle">
           <el-input v-model="form.departmentTitle" placeholder="请输入部职别" />
         </el-form-item>
         <el-form-item label="出生日期" prop="birth">
           <el-input v-model="form.birth" placeholder="请输入出生日期" />
         </el-form-item>
         <el-form-item label="性别" prop="gender">
           <el-input v-model="form.gender" placeholder="请输入性别" />
         </el-form-item>
         <el-form-item label="证件编号" prop="certificateId">
           <el-input v-model="form.certificateId" placeholder="请输入证件编号" />
         </el-form-item>
         <el-form-item label="年龄" prop="age">
           <el-input v-model="form.age" placeholder="请输入年龄" />
         </el-form-item>
         <el-form-item label="部门" prop="deptid">
           <el-input v-model="form.deptid" placeholder="请输入部门" />
         </el-form-item>
         <el-form-item label="身份证号" prop="idNumber">
           <el-input v-model="form.idNumber" placeholder="请输入身份证号" />
         </el-form-item>
         <el-form-item label="手机号1" prop="phoneOne">
           <el-input v-model="form.phoneOne" placeholder="请输入手机号1" />
         </el-form-item>
         <el-form-item label="手机号2" prop="phoneSecond">
           <el-input v-model="form.phoneSecond" placeholder="请输入手机号2" />
         </el-form-item>
         <el-form-item label="籍贯" prop="nativePlace">
           <el-input v-model="form.nativePlace" placeholder="请输入籍贯" />
         </el-form-item>
         <el-form-item label="出生地" prop="birthplace">
           <el-input v-model="form.birthplace" placeholder="请输入出生地" />
         </el-form-item>
         <el-form-item label="民族" prop="nation">
           <el-input v-model="form.nation" placeholder="请输入民族" />
         </el-form-item>
         <el-form-item label="最高学历" prop="highestEducation">
           <el-input v-model="form.highestEducation" placeholder="请输入最高学历" />
         </el-form-item>
         <el-form-item label="最高学位" prop="highestDegree">
           <el-input v-model="form.highestDegree" placeholder="请输入最高学位" />
         </el-form-item>
         <el-form-item label="毕业学校" prop="graduationSchool">
           <el-input v-model="form.graduationSchool" placeholder="请输入毕业学校" />
         </el-form-item>
         <el-form-item label="专业" prop="major">
           <el-input v-model="form.major" placeholder="请输入专业" />
         </el-form-item>
         <el-form-item label="人员类别" prop="personnelCategory">
           <el-input v-model="form.personnelCategory" placeholder="请输入人员类别" />
         </el-form-item>
         <el-form-item label="政治面貌" prop="politics">
           <el-input v-model="form.politics" placeholder="请输入政治面貌" />
         </el-form-item>
         <el-form-item label="入党" prop="partyTime">
           <el-date-picker clearable
                           v-model="form.partyTime"
                           type="date"
                           value-format="yyyy-MM-dd"
                           placeholder="请选择入党">
           </el-date-picker>
         </el-form-item>
         <el-form-item label="参加工作时间" prop="workingTime">
           <el-date-picker clearable
                           v-model="form.workingTime"
                           type="date"
                           value-format="yyyy-MM-dd"
                           placeholder="请选择参加工作时间">
           </el-date-picker>
         </el-form-item>
         <el-form-item label="入伍时间" prop="militaryTime">
           <el-date-picker clearable
                           v-model="form.militaryTime"
                           type="date"
                           value-format="yyyy-MM-dd"
                           placeholder="请选择入伍时间">
           </el-date-picker>
         </el-form-item>
         <el-form-item label="教育培训经历" prop="educationTraining">
           <el-input v-model="form.educationTraining" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="参加ZZ情况" prop="combatParticipation">
           <el-input v-model="form.combatParticipation" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="参加重大JS行动情况" prop="majorOperations">
           <el-input v-model="form.majorOperations" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="奖惩情况" prop="reward">
           <el-input v-model="form.reward" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="简历" prop="resume">
           <el-input v-model="form.resume" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="JX" prop="baseRank">
           <el-input v-model="form.baseRank" placeholder="请输入JX" />
         </el-form-item>
         <el-form-item label="用户ID" prop="userId">
           <el-input v-model="form.userId" placeholder="请输入用户ID" />
         </el-form-item>
         <el-form-item label="部门ID" prop="deptId">
           <el-input v-model="form.deptId" placeholder="请输入部门ID" />
         </el-form-item>
         <el-form-item label="备注" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="备注1" prop="note1">
           <el-input v-model="form.note1" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="备注2" prop="note2">
           <el-input v-model="form.note2" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="备注3" prop="note3">
           <el-input v-model="form.note3" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="备注4" prop="note4">
           <el-input v-model="form.note4" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="备注5" prop="note5">
           <el-input v-model="form.note5" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="备注6" prop="note6">
           <el-input v-model="form.note6" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="备注7" prop="note7">
           <el-input v-model="form.note7" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="备注8" prop="note8">
           <el-input v-model="form.note8" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="备注9" prop="note9">
           <el-input v-model="form.note9" type="textarea" placeholder="请输入内容" />
         </el-form-item>
         <el-form-item label="备注10" prop="note10">
           <el-input v-model="form.note10" type="textarea" placeholder="请输入内容" />
         </el-form-item>-->
          </el-main>
        </el-container>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listEducation, getEducation, delEducation, addEducation, updateEducation } from "@/api/module/yzx/education/education";
import watermark from "watermark-dom";

export default {
  name: "Education",
  mounted() {
    watermark.load({ watermark_txt: '  '   });
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 职业教育学习档案表格数据
      educationList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        learningContent: null,
        startingTime: null,
        endingTime: null,
        lecturer: null,
        lesson: null,
        location: null,
        personalNotes: null,
        learningExperience: null,
        id: null,
        username: null,
        departmentTitle: null,
        birth: null,
        gender: null,
        certificateId: null,
        age: null,
        deptid: null,
        idNumber: null,
        phoneOne: null,
        phoneSecond: null,
        nativePlace: null,
        birthplace: null,
        nation: null,
        highestEducation: null,
        highestDegree: null,
        graduationSchool: null,
        major: null,
        personnelCategory: null,
        politics: null,
        partyTime: null,
        workingTime: null,
        militaryTime: null,
        educationTraining: null,
        combatParticipation: null,
        majorOperations: null,
        reward: null,
        resume: null,
        baseRank: null,
        userId: null,
        deptId: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    indexMethod(index) {
      index = (index + 1) + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
      return index
    },
    /** 查询职业教育学习档案列表 */
    getList() {
      this.loading = true;
      listEducation(this.queryParams).then(response => {
        this.educationList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        studyRecordId: null,
        learningContent: null,
        startingTime: null,
        endingTime: null,
        lecturer: null,
        lesson: null,
        location: null,
        personalNotes: null,
        learningExperience: null,
        id: null,
        username: null,
        departmentTitle: null,
        birth: null,
        gender: null,
        certificateId: null,
        age: null,
        deptid: null,
        idNumber: null,
        phoneOne: null,
        phoneSecond: null,
        nativePlace: null,
        birthplace: null,
        nation: null,
        highestEducation: null,
        highestDegree: null,
        graduationSchool: null,
        major: null,
        personnelCategory: null,
        politics: null,
        partyTime: null,
        workingTime: null,
        militaryTime: null,
        educationTraining: null,
        combatParticipation: null,
        majorOperations: null,
        reward: null,
        resume: null,
        baseRank: null,
        userId: null,
        deptId: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.studyRecordId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加职业教育学习档案";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const studyRecordId = row.studyRecordId || this.ids
      getEducation(studyRecordId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改职业教育学习档案";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.studyRecordId != null) {
            updateEducation(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addEducation(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    handlelook(row) {
      const id = row.studyRecordId;
      // const tableName = row.tableName || this.tableNames[0];
      const params = {pageNum: this.queryParams.pageNum};

      this.$router.push({path: "/zonghe/eduxiangqing", query: {id}});
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const studyRecordIds = row.studyRecordId || this.ids;
      this.$modal.confirm('是否确认删除职业教育学习档案编号为"' + studyRecordIds + '"的数据项？').then(function() {
        return delEducation(studyRecordIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('yzx/education/education/export', {
        ...this.queryParams
      }, `education_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>

